//
//  RHMineViewCell.m
//  RuiHeAppApp
//
//  Created by Jun on 2023/7/19.
//

#import "RHMineViewCell.h"

@interface RHMineViewCell()

@property (nonatomic ,strong) UIImageView *iconV;

@property (nonatomic ,strong) QMUILabel *titleLab;

@property (nonatomic ,strong) QMUILabel *contetLab;

@property (nonatomic ,strong) UIView *line;
@end

@implementation RHMineViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self setupUI];
    }
    return self;
}

-(void)hideLine:(BOOL)isHide
{
    self.line.hidden = isHide;
}

- (void)setupUI{
    
    [self setBackgroundColor:UIColor.clearColor];
    [self.contentView setBackgroundColor:UIColor.clearColor];
    
    _bgView = [[UIView alloc] init];
    [_bgView setBackgroundColor:UIColor.whiteColor];
    _bgView.layer.cornerRadius = 8;
    _bgView.qmui_borderColor = kBorderColor;
    _bgView.qmui_borderWidth = 1;
    _bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:_bgView];
    
    _line = [[UIView alloc] init];
    [_line setBackgroundColor:CFCellLineColor];
    [_bgView addSubview:_line];
    
    _iconV = [[UIImageView alloc] init];
    [_bgView addSubview:_iconV];
    
    _titleLab = [[QMUILabel alloc] init];
    [_titleLab setTextAlignment:NSTextAlignmentLeft];
    [_titleLab setTextColor:kCOLOR_HEX(@"#303133")];
    [_titleLab setFont:[UIFont systemFontOfSize:14]];
    [_bgView addSubview:_titleLab];
    

    _contetLab = [[QMUILabel alloc] init];
    [_contetLab setTextAlignment:NSTextAlignmentRight];
    [_contetLab setTextColor:kCOLOR_HEX(@"#AAAAAA")];
    [_contetLab setFont:[UIFont systemFontOfSize:14]];
    [_bgView addSubview:_contetLab];
    

    UIImageView *arrowV = [[UIImageView alloc] init];
    [arrowV setImage:[UIImage imageNamed:@"cell_arrow"]];
    [_bgView addSubview:arrowV];
    
    
    kWeakSelf;
    [_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.top.bottom.mas_offset(0);
        make.height.mas_equalTo(50);
    }];
    
    [_line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.height.mas_equalTo(1);
        make.bottom.mas_offset(0);
    }];
    
    [arrowV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(15, 15));
        make.right.mas_offset(-15);
        make.centerY.mas_offset(0);
    }];
    
    [_iconV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(25, 25));
        make.left.mas_offset(10);
        make.centerY.mas_offset(0);
    }];
    
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.iconV.mas_right).offset(5);
        make.right.equalTo(weakSelf.contetLab.mas_left).offset(-5);
        make.centerY.mas_offset(0);
        make.height.mas_equalTo(30);
    }];
    
    [_contetLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(100);
        make.right.equalTo(arrowV.mas_left).offset(-5);
        make.centerY.mas_offset(0);
        make.height.mas_equalTo(30);
    }];
    
}

- (void)setTitleStr:(NSString *)titleStr{
    _titleStr = titleStr;
    [self.titleLab setText:_titleStr];
}

- (void)setIconStr:(NSString *)iconStr{
    _iconStr = iconStr;
    [self.iconV setImage:[UIImage imageNamed:_iconStr]];
}

- (void)setContentStr:(NSString *)contentStr{
    _contentStr = contentStr;
    [self.contetLab setText:_contentStr];
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
